package org.example.diet_compass.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import lombok.Data;

/**
 * ???ﳵ?
 * @TableName cart_items
 */
@TableName(value ="cart_items")
@Data
public class CartItems implements Serializable {
    /**
     * ??Ʒ ID
     */
    @TableId
    private String id;

    /**
     * SKU ID
     */
    private String skuId;

    /**
     * ??Ʒ?
     */
    private String name;

    /**
     * ͼƬ
     */
    private String picture;

    /**
     * ?
     */
    private Integer count;

    /**
     * ????ʱ?۸
     */
    private BigDecimal price;

    /**
     * ??ǰ?ļ۸
     */
    private BigDecimal nowPrice;

    /**
     * ???
     */
    private Integer stock;

    /**
     * ?Ƿ?ѡ?
     */
    private Integer selected;

    /**
     * ???????
     */
    private String attrsText;

    /**
     * ?Ƿ?Ϊ??Ч??Ʒ
     */
    private Integer isEffective;

    /**
     * ????ʱ?
     */
    private LocalDateTime createdAt;

    /**
     * ????ʱ?
     */
    private LocalDateTime updatedAt;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        CartItems other = (CartItems) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getSkuId() == null ? other.getSkuId() == null : this.getSkuId().equals(other.getSkuId()))
            && (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName()))
            && (this.getPicture() == null ? other.getPicture() == null : this.getPicture().equals(other.getPicture()))
            && (this.getCount() == null ? other.getCount() == null : this.getCount().equals(other.getCount()))
            && (this.getPrice() == null ? other.getPrice() == null : this.getPrice().equals(other.getPrice()))
            && (this.getNowPrice() == null ? other.getNowPrice() == null : this.getNowPrice().equals(other.getNowPrice()))
            && (this.getStock() == null ? other.getStock() == null : this.getStock().equals(other.getStock()))
            && (this.getSelected() == null ? other.getSelected() == null : this.getSelected().equals(other.getSelected()))
            && (this.getAttrsText() == null ? other.getAttrsText() == null : this.getAttrsText().equals(other.getAttrsText()))
            && (this.getIsEffective() == null ? other.getIsEffective() == null : this.getIsEffective().equals(other.getIsEffective()))
            && (this.getCreatedAt() == null ? other.getCreatedAt() == null : this.getCreatedAt().equals(other.getCreatedAt()))
            && (this.getUpdatedAt() == null ? other.getUpdatedAt() == null : this.getUpdatedAt().equals(other.getUpdatedAt()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getSkuId() == null) ? 0 : getSkuId().hashCode());
        result = prime * result + ((getName() == null) ? 0 : getName().hashCode());
        result = prime * result + ((getPicture() == null) ? 0 : getPicture().hashCode());
        result = prime * result + ((getCount() == null) ? 0 : getCount().hashCode());
        result = prime * result + ((getPrice() == null) ? 0 : getPrice().hashCode());
        result = prime * result + ((getNowPrice() == null) ? 0 : getNowPrice().hashCode());
        result = prime * result + ((getStock() == null) ? 0 : getStock().hashCode());
        result = prime * result + ((getSelected() == null) ? 0 : getSelected().hashCode());
        result = prime * result + ((getAttrsText() == null) ? 0 : getAttrsText().hashCode());
        result = prime * result + ((getIsEffective() == null) ? 0 : getIsEffective().hashCode());
        result = prime * result + ((getCreatedAt() == null) ? 0 : getCreatedAt().hashCode());
        result = prime * result + ((getUpdatedAt() == null) ? 0 : getUpdatedAt().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", skuId=").append(skuId);
        sb.append(", name=").append(name);
        sb.append(", picture=").append(picture);
        sb.append(", count=").append(count);
        sb.append(", price=").append(price);
        sb.append(", nowPrice=").append(nowPrice);
        sb.append(", stock=").append(stock);
        sb.append(", selected=").append(selected);
        sb.append(", attrsText=").append(attrsText);
        sb.append(", isEffective=").append(isEffective);
        sb.append(", createdAt=").append(createdAt);
        sb.append(", updatedAt=").append(updatedAt);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}